import javax.xml.stream.FactoryConfigurationError;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        System.out.println("请输入数字A,数字B,符号(+,-,*,/)");
        Scanner input = new Scanner(System.in);
        double NumberA = input.nextDouble();
        double NumberB = input.nextDouble();
        String operate = input.next();
        Operation operation = Factory.createOperation(NumberA,NumberB,operate);
        System.out.println("结果为"+ operation.operate());
    }
}
abstract class Operation{
    protected double NumberA;
    protected double NumberB;

    public Operation(double NumberA,double NumberB){
        this.NumberA = NumberA;
        this.NumberB = NumberB;
    }
    abstract double operate();
}

class AddOperation extends Operation{

    public AddOperation(double NumberA, double NumberB) {
        super(NumberA, NumberB);
    }

    @Override
    double operate() {
        return NumberA+NumberB;
    }
}

class SubOperation extends Operation{

    public SubOperation(double NumberA, double NumberB) {
        super(NumberA, NumberB);
    }

    @Override
    double operate() {
        return NumberA-NumberB;
    }
}

class MulOperation extends Operation{

    public MulOperation(double NumberA, double NumberB) {
        super(NumberA, NumberB);
    }

    @Override
    double operate() {
        return NumberA*NumberB;
    }
}
class DivOperation extends Operation{

    public DivOperation(double NumberA, double NumberB) {
        super(NumberA, NumberB);
    }

    @Override
    double operate() {
        return NumberA/NumberB;
    }
}
class Factory{
    public static Operation createOperation(double NumberA,double NumberB,String operate){
        Operation operation = null;
        switch (operate){
            case "+":
                operation = new AddOperation(NumberA,NumberB);
                break;
            case "-":
                operation = new SubOperation(NumberA,NumberB);
                break;
            case "*":
                operation = new MulOperation(NumberA,NumberB);
                break;
            case "/":
                operation = new DivOperation(NumberA,NumberB);
                break;
        }

        return operation;
    }
}
